//
//  AuthorityView.m
//  markmap
//
//  Created by 甘世清 on 2024/3/29.
//

#import "AuthorityView.h"

@implementation AuthorityView
- (void)SQ_UIViewForSelfView{
    self.backgroundColor = UIColor.whiteColor;
    self.layer.cornerRadius = 32;
    [self addSubview:self.gongkai];
    [self.gongkai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(20);
        make.width.mas_equalTo(SCREEN_WIDETH-40);
        make.height.mas_equalTo(40);
        make.top.equalTo(self).offset(40);
    }];
    [self addSubview:self.shiren];
    [self.shiren mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(20);
        make.width.mas_equalTo(SCREEN_WIDETH-40);
        make.height.mas_equalTo(40);
        make.top.equalTo(self).offset(100);
    }];
}
- (void)setIndex:(NSInteger)index{
    _index = index;
    if (index == 1) {
        self.gongkai.image = SQGetImage(@"选中");
        _gongkai.layer.borderColor =  SQColor(@"#000000").CGColor;
       
    } else {
        self.shiren.image = SQGetImage(@"选中");
        self.shiren.layer.borderColor =  SQColor(@"#000000").CGColor;
    }
}
- (SQCustomButton *)gongkai{
    if (!_gongkai) {
        _gongkai = [[SQCustomButton alloc]initType:SQCustomButtonRightImageType imageSize:CGSizeMake(24, 24) midmargin:34];
        _gongkai.text = SQNSLocalString(@"公开  所有人可看");
        _gongkai.font = FONT_MEDIUM(14);
        _gongkai.layer.cornerRadius = 20;
        _gongkai.layer.borderWidth = 1;
        _gongkai.layer.borderColor =  SQColor(@"#FFFFFF").CGColor;
    }
    return _gongkai;
}
- (SQCustomButton *)shiren{
    if (!_shiren) {
        _shiren = [[SQCustomButton alloc]initType:SQCustomButtonRightImageType imageSize:CGSizeMake(24, 24) midmargin:40];
        _shiren.text = SQNSLocalString(@"私人  仅自己可看");
        _shiren.font = FONT_MEDIUM(14);
        _shiren.layer.cornerRadius = 20;
        _shiren.layer.borderWidth = 1;
        _shiren.layer.borderColor =  SQColor(@"#FFFFFF").CGColor;
        
    }
    return _shiren;
}
@end
